20. Explore Espresso Further
Explore Espresso Further
Espresso helps us test:
- Views
- AdapterViews
- Intents
- Idling Resources
- Espresso Web (not covered in this lesson)
- RecyclerViews (not covered in this lesson)
Phew, we covered A LOT of Espresso. There are some additional components that we didn’t discuss:
Espresso Web - An API for writing automated tests for apps that contain one or more WebViews. Espresso Web reduce the boilerplate code needed to interact with these WebViews.
Espresso for RecylcerViews - Espresso testing for RecyclerViews works different from testing AdapterViews. It doesn’t use onData; instead, has actions that scroll to positions or perform actions on items.
Espresso Test Recorder
Android Studio also has a an Espresso Test Recorder which allows you to create UI tests by simply recording your interactions on a device and the Test Recorder will autogenerate the test code for you!
The tests are written using the same Espresso Testing framework that we just covered. At the time of creating this content there are certain limitations to the Test Recorder (e.g. it can't yet handle IdlingResources, it has limited number of assertions available). However, armed with the knowledge of how to write your own Espresso tests from scratch, you’ll be better equipped to understand, modify, and update any auto-generated tests if you do decide to use the Test Recorder.
Here are some helpful resources that can help you if you need to implement these in the future:
- Espresso Web - Examples Here and Here
- Espresso for RecylcerViews - Example here
- Using the Espresso Test Recorder